<%@ page contentType="text/html; charset=UTF-8" language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE HTML>
<html>
<head>
<title>三尺山教育信息咨询有限公司后台管理系统</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<script type="text/javascript" src="../../jslib/jquery-easyui-1.3.1/jquery-1.8.0.min.js"></script>
<script type="text/javascript" src="../../jslib/jquery-easyui-1.3.1/jquery.easyui.min.js"></script>
<script type="text/javascript" src="../../jslib/jquery-easyui-1.3.1/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript" src="../../jslib/tools.js"></script>
<link rel="stylesheet" href="../../jslib/jquery-easyui-1.3.1/themes/default/easyui.css" type="text/css"></link>
<link rel="stylesheet" href="../../jslib/jquery-easyui-1.3.1/themes/icon.css" type="text/css"></link>
<style type="text/css">
.myBut {
	border: 1px solid #00FF99;
	background-color: #CCE8CF;
}
</style>
<script type="text/javascript" charset="utf-8">
$(function() {
	$('#moduls_user_datagrid').datagrid({
		url : '${pageContext.request.contextPath}/bookAction!getList.action',
		fit : true,
		pagination : true,
		border : false,
		checkOnSelect : false,
		rownumbers : true,
		pageList: [20, 40, 60, 80, 100],
		selectOnCheck : false,
		idField : 'id',
		nowrap : false,
		columns : [ [ {
			title : 'ID',
			field : 'id',
			width : 50,
			hidden : true
		}, {
			title : '杂志名称',
			field : 'name',
			width : 250
		}, {
			title : '封面人物',
			field : 'peopleName',
			width : 100
		}, {
			title : '添加时间',
			field : 'addDate',
			width : 150
		}, {
			title : '杂志描述',
			field : 'des',
			width : 300,
			formatter : function(value, row, index) {
				return '<span title="'+value+'">' + (value.length <= 21 ? value : (value.substring(0, 21) +'...')) +'</span>';
			}
		},{
			field : 'action1',
			title : '操作',
			width : 80,
			formatter : function(value, row, index) {
				return '<a href="${pageContext.request.contextPath}/Admin/BookManager/BookModify.jsp?id='+row.id+'"><img alt="修改" src="${pageContext.request.contextPath}/jslib/jquery-easyui-1.3.1/themes/icons/book_edit.png"></a>&nbsp;&nbsp;<a href="javascript:void(0)" onclick="del('+row.id+')" ><img alt="删除" src="${pageContext.request.contextPath}/jslib/jquery-easyui-1.3.1/themes/icons/icon_trash.gif"></a>';
			}
		}] ],
		toolbar : [ {
			text : '添加杂志 ',
			iconCls : 'icon-add',
			handler : function() {
				window.location.href="BookEdit.jsp";
			}
		} ]
	});
});

function del(id) {
	$.messager.confirm('确认', '您是否要删除？', function(r) {
		if (r) {
			$.ajax({
				url : '${pageContext.request.contextPath}/bookAction!delete.action',
				data : {
					id : id
				},
				dataType : 'json',
				success : function(result) {
					if (result.success) {
						$('#moduls_user_datagrid').datagrid('load');
					}
					$.messager.show({
						title : '提示',
						msg : result.msg
					});
				}
			});
		}
	});
}
function modify(id) {
	new_id = id;
	addPage('moduls/modifyNew.jsp');
}
</script>
</head>
<body>
<table id="moduls_user_datagrid"></table>
</body>